import django_filters
from .models import *


class ItemFilter(django_filters.rest_framework.FilterSet):
    """过滤器"""

    id = django_filters.CharFilter(lookup_expr='icontains')
    name = django_filters.CharFilter(lookup_expr='icontains')
    minStock = django_filters.NumberFilter(field_name='item_sku__stock', help_text="最小库存", lookup_expr='gte')
    maxStock = django_filters.NumberFilter(field_name='item_sku__stock', help_text="最大库存", lookup_expr='lte')
    
    class Meta:
        model = Item
        fields = '__all__'
